package com.topvision.face.util;

import android.util.Log;

/**
 * 线程工具
 * @author sikaijian
 *
 */
public class ThreadUtil {
	/**
	 * 同步执行一个线程
	 * @param cmd 
	 */
	public static void executeSync(Runnable cmd){
		Thread t = new Thread(cmd);
		t.start();
		
		try {
			t.join();
		} catch (InterruptedException e) {
			Log.e("sk", "Thread join Interrupted!");
		}
	}
	
	/**
	 * 异步执行一个线程
	 * @param cmd
	 * @return 线程句柄
	 */
	public static Thread executeAsyn(Runnable cmd){
		Thread t = new Thread(cmd);
		t.start();
		
		return t;
	}
}
